]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
lockScreen: Don't wake up screen in DND mode
authorkyte <kyteinsky@gmail.com>
Sat, 27 Nov 2021 07:50:23 +0000 (13:20 +0530)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 23 Dec 2021 16:20:49 +0000 (17:20 +0100)
Screen woke up whenever a new notification popped up
on lock screen even when DND was turned on.
This commit changes this behaviour to not wake
the screen up in such case.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4710

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2051>

js/ui/unlockDialog.js

index 3ef6aa90f053d75d6db50e30c6f8bb58079e8ae6..367117bfd5f0e93f948c635910cd4c663cd23fbb 100644 (file)
@@ -46,6 +46,10 @@ var NotificationsBox = GObject.registerClass({
 
         this.add_child(this._scrollView);
 
+        this._settings = new Gio.Settings({
+            schema_id: 'org.gnome.desktop.notifications',
+        });
+
         this._sources = new Map();
         Main.messageTray.getSources().forEach(source => {
             this._sourceAdded(Main.messageTray, source, true);
@@ -176,6 +180,14 @@ var NotificationsBox = GObject.registerClass({
         this._updateSourceBoxStyle(source, obj, box);
     }
 
+    _wakeUpScreenForSource(source) {
+        if (!this._settings.get_boolean('show-banners'))
+            return;
+        const obj = this._sources.get(source);
+        if (obj?.sourceBox.visible)
+            this.emit('wake-up-screen');
+    }
+
     _sourceAdded(tray, source, initial) {
         let obj = {
             visible: source.policy.showInLockScreen,
@@ -235,8 +247,7 @@ var NotificationsBox = GObject.registerClass({
             });
 
             this._updateVisibility();
-            if (obj.sourceBox.visible)
-                this.emit('wake-up-screen');
+            this._wakeUpScreenForSource(source);
         }
     }
 
@@ -268,8 +279,7 @@ var NotificationsBox = GObject.registerClass({
         obj.sourceBox.visible = obj.visible && (source.unseenCount > 0);
 
         this._updateVisibility();
-        if (obj.sourceBox.visible)
-            this.emit('wake-up-screen');
+        this._wakeUpScreenForSource(source);
     }
 
     _visibleChanged(source, obj) {
@@ -280,8 +290,7 @@ var NotificationsBox = GObject.registerClass({
         obj.sourceBox.visible = obj.visible && source.unseenCount > 0;
 
         this._updateVisibility();
-        if (obj.sourceBox.visible)
-            this.emit('wake-up-screen');
+        this._wakeUpScreenForSource(source);
     }
 
     _detailedChanged(source, obj) {